package com.job.client.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import com.client.job.core.annos.MJobScanner;


/**
 * 初始化任务线程池以及加载任务索要扫描的包
 * @des
 * @author mengxiangzhong
 * @date 2021年8月31日
 *
 */




@Configuration
@ComponentScan(basePackages = { "com.client.job.*"})
@MJobScanner(basePackages = {"com.job.client.jobs.*"})
@Slf4j
public class JobCoreConfig {

	 /**
     * 创建ThreadPoolTaskScheduler线程池
     */
    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        log.info("实例化线程");
        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
        threadPoolTaskScheduler.setBeanName("my-task-pool");
        threadPoolTaskScheduler.setPoolSize(10);
        return threadPoolTaskScheduler;
    }
	
	
}
